<template>
  <div class="animals">
    <section>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </section>
    <div class="text-box">
      <div>我和小动物们来给小哥哥过生日啦</div>
      <div>——扁蛋蛋&小动物们</div>
    </div>
  </div>
</template>

<script>
export default {
  mounted () {
    setTimeout(() => {
      this.$router.push('/cake')
    }, 16000)
  }
}
</script>

<style scoped>
.animals {
  width: 90%;
  height: 100%;
}
section {
  position: relative;
  margin-top: 5%;
  margin-left: 47%;
  width: 250px;
  height: 200px;
  transform-style: preserve-3d;
  transition: all 16s;
  animation: rotate 16s linear 1 forwards;
  animation: rotate 10s linear infinite forwards;
  z-index: 2;
}
section div {
  position: absolute;
  width: 100%;
  height: 100%;
  box-shadow: rgba(0, 0, 0, .3) 7px 7px 7px;
}
@keyframes rotate {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(-180deg);
  }
  100% {
    transform: rotateY(-360deg);
  }
}
@keyframes opacity {
  0% {
    opacity: .9;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
section:hover {
  animation-play-state: paused;
}
section div:nth-child(1) {
  background: url(../image/jpg/熊.jpg);
  background-size: 100% 100%;
  transform: translateZ(260px);
}
section div:nth-child(2) {
  background: url(../image/jpg/小粉狗.jpg);
  background-size: 100% 100%;
  transform: rotateY(60deg) translateZ(260px);
}
section div:nth-child(3) {
  background: url(../image/jpg/大猩猩.jpg);
  background-size: 100% 100%;
  transform: rotateY(120deg) translateZ(260px);
}
section div:nth-child(4) {
  background: url(../image/jpg/小兔子.jpg);
  background-size: 100% 100%;
  transform: rotateY(180deg) translateZ(260px);
}
section div:nth-child(5) {
  background: url(../image/jpg/小羊.jpg);
  background-size: 100% 100%;
  transform: rotateY(240deg) translateZ(260px);
}
section div:nth-child(6) {
  background: url(../image/jpg/小恐龙.jpg);
  background-size: 100% 100%;
  transform: rotateY(300deg) translateZ(260px);
}
section div:nth-child(-n+6) {
  animation: opacity 16s linear 1 forwards;
  /* animation: opacity 10s linear infinite forwards; */
}
.text-box {
  position: relative;
  margin: 8% auto;
  left: 3%;
  width: 90%;
  height: 45%;
  animation: opacity 16s linear 1 forwards;
  z-index: 1;
}
.text-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: rgb(255, 17, 0);
  opacity: .1;
}
.text-box div {
  width: 100%;
  top: 30%;
  color: rgb(243, 59, 59);
  font-weight: 700;
  font-size: 25px;
  text-align: center;
}
.text-box div:nth-child(2) {
  top: 60%;
  left: 10%;
}
</style>
